<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Compress::Zlib - Interface to zlib compression library - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/Compress::Zlib">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Compress::Zlib.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/Compress::Zlib">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/Compress::Zlib">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/Compress::Zlib">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/Compress::Zlib">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/Compress::Zlib">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/Compress::Zlib">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/Compress::Zlib">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/Compress::Zlib">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/Compress::Zlib">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/Compress::Zlib">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/Compress::Zlib">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/Compress::Zlib">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/Compress::Zlib">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/Compress::Zlib">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/Compress::Zlib">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/Compress::Zlib">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/Compress::Zlib">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/Compress::Zlib">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/Compress::Zlib">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/Compress::Zlib">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/Compress::Zlib">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/Compress::Zlib">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/Compress::Zlib">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/Compress::Zlib">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/Compress::Zlib">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/Compress::Zlib">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/Compress::Zlib">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/Compress::Zlib">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/Compress::Zlib">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/Compress::Zlib">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/Compress::Zlib">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/Compress::Zlib">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/Compress::Zlib">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/Compress::Zlib">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/Compress::Zlib">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/Compress::Zlib">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/Compress::Zlib">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/Compress::Zlib">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/Compress::Zlib">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/Compress::Zlib">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/Compress::Zlib">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/Compress::Zlib">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/Compress::Zlib">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/Compress::Zlib">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/Compress::Zlib">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/Compress::Zlib">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/Compress::Zlib">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/Compress::Zlib">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/Compress::Zlib">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/Compress::Zlib">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/Compress::Zlib">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/Compress::Zlib">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/Compress::Zlib">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/Compress::Zlib">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/Compress::Zlib">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/Compress::Zlib">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/Compress::Zlib">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/Compress::Zlib">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/Compress::Zlib">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/Compress::Zlib">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/Compress::Zlib">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/Compress::Zlib">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/Compress::Zlib">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/Compress::Zlib">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/Compress::Zlib">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/Compress::Zlib">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/Compress::Zlib">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/Compress::Zlib">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/Compress::Zlib">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/Compress::Zlib">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/Compress::Zlib">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/Compress::Zlib">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/Compress::Zlib">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/Compress::Zlib">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/Compress::Zlib">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/Compress::Zlib">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/Compress::Zlib">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/Compress::Zlib">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/Compress::Zlib">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/Compress::Zlib">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Compress::Zlib.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/Compress::Zlib">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/Compress::Zlib">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/Compress::Zlib">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/Compress::Zlib">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/Compress::Zlib">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/Compress::Zlib">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/Compress::Zlib">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/Compress::Zlib">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/Compress::Zlib">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/Compress::Zlib">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/Compress::Zlib">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/Compress::Zlib">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/Compress::Zlib">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/Compress::Zlib">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/Compress::Zlib">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/Compress::Zlib">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/Compress::Zlib">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/Compress::Zlib">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/Compress::Zlib">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/Compress::Zlib">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/Compress::Zlib">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/Compress::Zlib">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/Compress::Zlib">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/Compress::Zlib">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/Compress::Zlib">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/Compress::Zlib">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/Compress::Zlib">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/Compress::Zlib">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/Compress::Zlib">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/Compress::Zlib">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/Compress::Zlib">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/Compress::Zlib">5.35.1</a>
          <a class="dropdown-item active" href="./Compress::Zlib.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Compress::Zlib.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./Compress::Zlib.html">Compress::Zlib</a>
          <div id="more">
            (<a href="./Compress::Zlib.txt">source</a>,
            <a href="https://metacpan.org/pod/Compress::Zlib">CPAN</a>)
          </div>
            <div id="moduleversion">version 2.102</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#DESCRIPTION">DESCRIPTION</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#Notes-for-users-of-Compress::Zlib-version-1">Notes for users of Compress::Zlib version 1</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#GZIP-INTERFACE">GZIP INTERFACE</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#Examples">Examples</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#Compress::Zlib::memGzip">Compress::Zlib::memGzip</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#Compress::Zlib::memGunzip">Compress::Zlib::memGunzip</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#COMPRESS/UNCOMPRESS">COMPRESS/UNCOMPRESS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#Deflate-Interface">Deflate Interface</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#($d,-$status)-=-deflateInit(-%5BOPT%5D-)">($d, $status) = deflateInit( [OPT] )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#($out,-$status)-=-$d-%3Edeflate($buffer)">($out, $status) = $d-&gt;deflate($buffer)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#($out,-$status)-=-$d-%3Eflush()-=head2-($out,-$status)-=-$d-%3Eflush($flush_type)">($out, $status) = $d-&gt;flush() =head2 ($out, $status) = $d-&gt;flush($flush_type)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#$status-=-$d-%3EdeflateParams(%5BOPT%5D)">$status = $d-&gt;deflateParams([OPT])</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#$d-%3Edict_adler()">$d-&gt;dict_adler()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#$d-%3Emsg()">$d-&gt;msg()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#$d-%3Etotal_in()">$d-&gt;total_in()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#$d-%3Etotal_out()">$d-&gt;total_out()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#Example">Example</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#Inflate-Interface">Inflate Interface</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#($i,-$status)-=-inflateInit()">($i, $status) = inflateInit()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#($out,-$status)-=-$i-%3Einflate($buffer)">($out, $status) = $i-&gt;inflate($buffer)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#$status-=-$i-%3EinflateSync($buffer)">$status = $i-&gt;inflateSync($buffer)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#$i-%3Edict_adler()">$i-&gt;dict_adler()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#$i-%3Emsg()">$i-&gt;msg()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#$i-%3Etotal_in()">$i-&gt;total_in()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#$i-%3Etotal_out()">$i-&gt;total_out()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#Example1">Example</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#CHECKSUM-FUNCTIONS">CHECKSUM FUNCTIONS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#Misc">Misc</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#my-$version-=-Compress::Zlib::zlib_version();">my $version = Compress::Zlib::zlib_version();</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#CONSTANTS">CONSTANTS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#SUPPORT">SUPPORT</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#SEE-ALSO">SEE ALSO</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#AUTHOR">AUTHOR</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#MODIFICATION-HISTORY">MODIFICATION HISTORY</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Compress::Zlib.html#COPYRIGHT-AND-LICENSE">COPYRIGHT AND LICENSE</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./Compress::Zlib.html#NAME">#</a>NAME</h1>

<p>Compress::Zlib - Interface to zlib compression library</p>

<h1 id="SYNOPSIS"><a class="permalink" href="./Compress::Zlib.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<pre><code>use Compress::Zlib ;

($d, $status) = deflateInit( [OPT] ) ;
$status = $d-&gt;deflate($input, $output) ;
$status = $d-&gt;flush([$flush_type]) ;
$d-&gt;deflateParams(OPTS) ;
$d-&gt;deflateTune(OPTS) ;
$d-&gt;dict_adler() ;
$d-&gt;crc32() ;
$d-&gt;adler32() ;
$d-&gt;total_in() ;
$d-&gt;total_out() ;
$d-&gt;msg() ;
$d-&gt;get_Strategy();
$d-&gt;get_Level();
$d-&gt;get_BufSize();

($i, $status) = inflateInit( [OPT] ) ;
$status = $i-&gt;inflate($input, $output [, $eof]) ;
$status = $i-&gt;inflateSync($input) ;
$i-&gt;dict_adler() ;
$d-&gt;crc32() ;
$d-&gt;adler32() ;
$i-&gt;total_in() ;
$i-&gt;total_out() ;
$i-&gt;msg() ;
$d-&gt;get_BufSize();

$dest = compress($source) ;
$dest = uncompress($source) ;

$gz = gzopen($filename or filehandle, $mode) ;
$bytesread = $gz-&gt;gzread($buffer [,$size]) ;
$bytesread = $gz-&gt;gzreadline($line) ;
$byteswritten = $gz-&gt;gzwrite($buffer) ;
$status = $gz-&gt;gzflush($flush) ;
$offset = $gz-&gt;gztell() ;
$status = $gz-&gt;gzseek($offset, $whence) ;
$status = $gz-&gt;gzclose() ;
$status = $gz-&gt;gzeof() ;
$status = $gz-&gt;gzsetparams($level, $strategy) ;
$errstring = $gz-&gt;gzerror() ;
$gzerrno

$dest = Compress::Zlib::memGzip($buffer) ;
$dest = Compress::Zlib::memGunzip($buffer) ;

$crc = adler32($buffer [,$crc]) ;
$crc = crc32($buffer [,$crc]) ;

$crc = crc32_combine($crc1, $crc2, $len2);
$adler = adler32_combine($adler1, $adler2, $len2);

my $version = Compress::Raw::Zlib::zlib_version();</code></pre>

<h1 id="DESCRIPTION"><a class="permalink" href="./Compress::Zlib.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>The <i>Compress::Zlib</i> module provides a Perl interface to the <i>zlib</i> compression library (see <a href="./Compress::Zlib.html#AUTHOR">&quot;AUTHOR&quot;</a> for details about where to get <i>zlib</i>).</p>

<p>The <code>Compress::Zlib</code> module can be split into two general areas of functionality, namely a simple read/write interface to <i>gzip</i> files and a low-level in-memory compression/decompression interface.</p>

<p>Each of these areas will be discussed in the following sections.</p>

<h2 id="Notes-for-users-of-Compress::Zlib-version-1"><a class="permalink" href="./Compress::Zlib.html#Notes-for-users-of-Compress::Zlib-version-1">#</a><a id="Notes"></a>Notes for users of Compress::Zlib version 1</h2>

<p>The main change in <code>Compress::Zlib</code> version 2.x is that it does not now interface directly to the zlib library. Instead it uses the <code>IO::Compress::Gzip</code> and <code>IO::Uncompress::Gunzip</code> modules for reading/writing gzip files, and the <code>Compress::Raw::Zlib</code> module for some low-level zlib access.</p>

<p>The interface provided by version 2 of this module should be 100% backward compatible with version 1. If you find a difference in the expected behaviour please contact the author (See <a href="./Compress::Zlib.html#AUTHOR">&quot;AUTHOR&quot;</a>). See <a href="./Compress::Zlib.html#GZIP-INTERFACE">&quot;GZIP INTERFACE&quot;</a></p>

<p>With the creation of the <code>IO::Compress</code> and <code>IO::Uncompress</code> modules no new features are planned for <code>Compress::Zlib</code> - the new modules do everything that <code>Compress::Zlib</code> does and then some. Development on <code>Compress::Zlib</code> will be limited to bug fixes only.</p>

<p>If you are writing new code, your first port of call should be one of the new <code>IO::Compress</code> or <code>IO::Uncompress</code> modules.</p>

<h1 id="GZIP-INTERFACE"><a class="permalink" href="./Compress::Zlib.html#GZIP-INTERFACE">#</a><a id="GZIP"></a>GZIP INTERFACE</h1>

<p>A number of functions are supplied in <i>zlib</i> for reading and writing <i>gzip</i> files that conform to RFC 1952. This module provides an interface to most of them.</p>

<p>If you have previously used <code>Compress::Zlib</code> 1.x, the following enhancements/changes have been made to the <code>gzopen</code> interface:</p>

<ol>

<li><p>If you want to open either STDIN or STDOUT with <code>gzopen</code>, you can now optionally use the special filename &quot;<code>-</code>&quot; as a synonym for <code>\*STDIN</code> and <code>\*STDOUT</code>.</p>

</li>
<li><p>In <code>Compress::Zlib</code> version 1.x, <code>gzopen</code> used the zlib library to open the underlying file. This made things especially tricky when a Perl filehandle was passed to <code>gzopen</code>. Behind the scenes the numeric C file descriptor had to be extracted from the Perl filehandle and this passed to the zlib library.</p>

<p>Apart from being non-portable to some operating systems, this made it difficult to use <code>gzopen</code> in situations where you wanted to extract/create a gzip data stream that is embedded in a larger file, without having to resort to opening and closing the file multiple times.</p>

<p>It also made it impossible to pass a perl filehandle that wasn&#39;t associated with a real filesystem file, like, say, an <code>IO::String</code>.</p>

<p>In <code>Compress::Zlib</code> version 2.x, the <code>gzopen</code> interface has been completely rewritten to use the <a href="./IO::Compress::Gzip.html">IO::Compress::Gzip</a> for writing gzip files and <a href="./IO::Uncompress::Gunzip.html">IO::Uncompress::Gunzip</a> for reading gzip files. None of the limitations mentioned above apply.</p>

</li>
<li><p>Addition of <code>gzseek</code> to provide a restricted <code>seek</code> interface.</p>

</li>
<li><p>Added <code>gztell</code>.</p>

</li>
</ol>

<p>A more complete and flexible interface for reading/writing gzip files/buffers is included with the module <code>IO-Compress-Zlib</code>. See <a href="./IO::Compress::Gzip.html">IO::Compress::Gzip</a> and <a href="./IO::Uncompress::Gunzip.html">IO::Uncompress::Gunzip</a> for more details.</p>

<dl>

<dt id="$gz-=-gzopen($filename,-$mode)"><a class="permalink" href="./Compress::Zlib.html#$gz-=-gzopen($filename,-$mode)">#</a><a id="gz-gzopen-filename-mode"></a><b>$gz = gzopen($filename, $mode)</b></dt>
<dd>

</dd>
<dt id="$gz-=-gzopen($filehandle,-$mode)"><a class="permalink" href="./Compress::Zlib.html#$gz-=-gzopen($filehandle,-$mode)">#</a><a id="gz-gzopen-filehandle-mode"></a><b>$gz = gzopen($filehandle, $mode)</b></dt>
<dd>

<p>This function opens either the <i>gzip</i> file <code>$filename</code> for reading or writing or attaches to the opened filehandle, <code>$filehandle</code>. It returns an object on success and <code>undef</code> on failure.</p>

<p>When writing a gzip file this interface will <i>always</i> create the smallest possible gzip header (exactly 10 bytes). If you want greater control over what gets stored in the gzip header (like the original filename or a comment) use <a href="./IO::Compress::Gzip.html">IO::Compress::Gzip</a> instead. Similarly if you want to read the contents of the gzip header use <a href="./IO::Uncompress::Gunzip.html">IO::Uncompress::Gunzip</a>.</p>

<p>The second parameter, <code>$mode</code>, is used to specify whether the file is opened for reading or writing and to optionally specify a compression level and compression strategy when writing. The format of the <code>$mode</code> parameter is similar to the mode parameter to the &#39;C&#39; function <code>fopen</code>, so &quot;rb&quot; is used to open for reading, &quot;wb&quot; for writing and &quot;ab&quot; for appending (writing at the end of the file).</p>

<p>To specify a compression level when writing, append a digit between 0 and 9 to the mode string -- 0 means no compression and 9 means maximum compression. If no compression level is specified Z_DEFAULT_COMPRESSION is used.</p>

<p>To specify the compression strategy when writing, append &#39;f&#39; for filtered data, &#39;h&#39; for Huffman only compression, or &#39;R&#39; for run-length encoding. If no strategy is specified Z_DEFAULT_STRATEGY is used.</p>

<p>So, for example, &quot;wb9&quot; means open for writing with the maximum compression using the default strategy and &quot;wb4R&quot; means open for writing with compression level 4 and run-length encoding.</p>

<p>Refer to the <i>zlib</i> documentation for the exact format of the <code>$mode</code> parameter.</p>

</dd>
<dt id="$bytesread-=-$gz-&gt;gzread($buffer-[,-$size])-;"><a class="permalink" href="./Compress::Zlib.html#$bytesread-=-$gz-%3Egzread($buffer-%5B,-$size%5D)-;">#</a><a id="bytesread-gz-gzread-buffer-size"></a><b>$bytesread = $gz-&gt;gzread($buffer [, $size]) ;</b></dt>
<dd>

<p>Reads <code>$size</code> bytes from the compressed file into <code>$buffer</code>. If <code>$size</code> is not specified, it will default to 4096. If the scalar <code>$buffer</code> is not large enough, it will be extended automatically.</p>

<p>Returns the number of bytes actually read. On EOF it returns 0 and in the case of an error, -1.</p>

</dd>
<dt id="$bytesread-=-$gz-&gt;gzreadline($line)-;"><a class="permalink" href="./Compress::Zlib.html#$bytesread-=-$gz-%3Egzreadline($line)-;">#</a><a id="bytesread-gz-gzreadline-line"></a><b>$bytesread = $gz-&gt;gzreadline($line) ;</b></dt>
<dd>

<p>Reads the next line from the compressed file into <code>$line</code>.</p>

<p>Returns the number of bytes actually read. On EOF it returns 0 and in the case of an error, -1.</p>

<p>It is legal to intermix calls to <code>gzread</code> and <code>gzreadline</code>.</p>

<p>To maintain backward compatibility with version 1.x of this module <code>gzreadline</code> ignores the <code>$/</code> variable - it <i>always</i> uses the string <code>&quot;\n&quot;</code> as the line delimiter.</p>

<p>If you want to read a gzip file a line at a time and have it respect the <code>$/</code> variable (or <code>$INPUT_RECORD_SEPARATOR</code>, or <code>$RS</code> when <code>English</code> is in use) see <a href="./IO::Uncompress::Gunzip.html">IO::Uncompress::Gunzip</a>.</p>

</dd>
<dt id="$byteswritten-=-$gz-&gt;gzwrite($buffer)-;"><a class="permalink" href="./Compress::Zlib.html#$byteswritten-=-$gz-%3Egzwrite($buffer)-;">#</a><a id="byteswritten-gz-gzwrite-buffer"></a><b>$byteswritten = $gz-&gt;gzwrite($buffer) ;</b></dt>
<dd>

<p>Writes the contents of <code>$buffer</code> to the compressed file. Returns the number of bytes actually written, or 0 on error.</p>

</dd>
<dt id="$status-=-$gz-&gt;gzflush($flush_type)-;"><a class="permalink" href="./Compress::Zlib.html#$status-=-$gz-%3Egzflush($flush_type)-;">#</a><a id="status-gz-gzflush-flush_type"></a><b>$status = $gz-&gt;gzflush($flush_type) ;</b></dt>
<dd>

<p>Flushes all pending output into the compressed file.</p>

<p>This method takes an optional parameter, <code>$flush_type</code>, that controls how the flushing will be carried out. By default the <code>$flush_type</code> used is <code>Z_FINISH</code>. Other valid values for <code>$flush_type</code> are <code>Z_NO_FLUSH</code>, <code>Z_SYNC_FLUSH</code>, <code>Z_FULL_FLUSH</code> and <code>Z_BLOCK</code>. It is strongly recommended that you only set the <code>flush_type</code> parameter if you fully understand the implications of what it does - overuse of <code>flush</code> can seriously degrade the level of compression achieved. See the <code>zlib</code> documentation for details.</p>

<p>Returns 0 on success.</p>

</dd>
<dt id="$offset-=-$gz-&gt;gztell()-;"><a class="permalink" href="./Compress::Zlib.html#$offset-=-$gz-%3Egztell()-;">#</a><a id="offset-gz-gztell"></a><b>$offset = $gz-&gt;gztell() ;</b></dt>
<dd>

<p>Returns the uncompressed file offset.</p>

</dd>
<dt id="$status-=-$gz-&gt;gzseek($offset,-$whence)-;"><a class="permalink" href="./Compress::Zlib.html#$status-=-$gz-%3Egzseek($offset,-$whence)-;">#</a><a id="status-gz-gzseek-offset-whence"></a><b>$status = $gz-&gt;gzseek($offset, $whence) ;</b></dt>
<dd>

<p>Provides a sub-set of the <code>seek</code> functionality, with the restriction that it is only legal to seek forward in the compressed file. It is a fatal error to attempt to seek backward.</p>

<p>When opened for writing, empty parts of the file will have NULL (0x00) bytes written to them.</p>

<p>The <code>$whence</code> parameter should be one of SEEK_SET, SEEK_CUR or SEEK_END.</p>

<p>Returns 1 on success, 0 on failure.</p>

</dd>
<dt id="$gz-&gt;gzclose"><a class="permalink" href="./Compress::Zlib.html#$gz-%3Egzclose">#</a><a id="gzclose"></a><a id="gz-gzclose"></a><b>$gz-&gt;gzclose</b></dt>
<dd>

<p>Closes the compressed file. Any pending data is flushed to the file before it is closed.</p>

<p>Returns 0 on success.</p>

</dd>
<dt id="$gz-&gt;gzsetparams($level,-$strategy"><a class="permalink" href="./Compress::Zlib.html#$gz-%3Egzsetparams($level,-$strategy">#</a><a id="gzsetparams"></a><a id="gz-gzsetparams-level-strategy"></a><b>$gz-&gt;gzsetparams($level, $strategy</b></dt>
<dd>

<p>Change settings for the deflate stream <code>$gz</code>.</p>

<p>The list of the valid options is shown below. Options not specified will remain unchanged.</p>

<p>Note: This method is only available if you are running zlib 1.0.6 or better.</p>

<dl>

<dt id="$level"><a class="permalink" href="./Compress::Zlib.html#$level">#</a><a id="level"></a><b>$level</b></dt>
<dd>

<p>Defines the compression level. Valid values are 0 through 9, <code>Z_NO_COMPRESSION</code>, <code>Z_BEST_SPEED</code>, <code>Z_BEST_COMPRESSION</code>, and <code>Z_DEFAULT_COMPRESSION</code>.</p>

</dd>
<dt id="$strategy"><a class="permalink" href="./Compress::Zlib.html#$strategy">#</a><a id="strategy"></a><b>$strategy</b></dt>
<dd>

<p>Defines the strategy used to tune the compression. The valid values are <code>Z_DEFAULT_STRATEGY</code>, <code>Z_FILTERED</code> and <code>Z_HUFFMAN_ONLY</code>.</p>

</dd>
</dl>

</dd>
<dt id="$gz-&gt;gzerror"><a class="permalink" href="./Compress::Zlib.html#$gz-%3Egzerror">#</a><a id="gzerror"></a><a id="gz-gzerror"></a><b>$gz-&gt;gzerror</b></dt>
<dd>

<p>Returns the <i>zlib</i> error message or number for the last operation associated with <code>$gz</code>. The return value will be the <i>zlib</i> error number when used in a numeric context and the <i>zlib</i> error message when used in a string context. The <i>zlib</i> error number constants, shown below, are available for use.</p>

<pre><code class="plaintext">Z_OK
Z_STREAM_END
Z_ERRNO
Z_STREAM_ERROR
Z_DATA_ERROR
Z_MEM_ERROR
Z_BUF_ERROR</code></pre>

</dd>
<dt id="$gzerrno"><a class="permalink" href="./Compress::Zlib.html#$gzerrno">#</a><a id="gzerrno"></a><b>$gzerrno</b></dt>
<dd>

<p>The <code>$gzerrno</code> scalar holds the error code associated with the most recent <i>gzip</i> routine. Note that unlike <code>gzerror()</code>, the error is <i>not</i> associated with a particular file.</p>

<p>As with <code>gzerror()</code> it returns an error number in numeric context and an error message in string context. Unlike <code>gzerror()</code> though, the error message will correspond to the <i>zlib</i> message when the error is associated with <i>zlib</i> itself, or the UNIX error message when it is not (i.e. <i>zlib</i> returned <code>Z_ERRORNO</code>).</p>

<p>As there is an overlap between the error numbers used by <i>zlib</i> and UNIX, <code>$gzerrno</code> should only be used to check for the presence of <i>an</i> error in numeric context. Use <code>gzerror()</code> to check for specific <i>zlib</i> errors. The <i>gzcat</i> example below shows how the variable can be used safely.</p>

</dd>
</dl>

<h2 id="Examples"><a class="permalink" href="./Compress::Zlib.html#Examples">#</a>Examples</h2>

<p>Here is an example script which uses the interface. It implements a <i>gzcat</i> function.</p>

<pre><code>use strict ;
use warnings ;

use Compress::Zlib ;

# use stdin if no files supplied
@ARGV = &#39;-&#39; unless @ARGV ;

foreach my $file (@ARGV) {
    my $buffer ;

    my $gz = gzopen($file, &quot;rb&quot;)
         or die &quot;Cannot open $file: $gzerrno\n&quot; ;

    print $buffer while $gz-&gt;gzread($buffer) &gt; 0 ;

    die &quot;Error reading from $file: $gzerrno&quot; . ($gzerrno+0) . &quot;\n&quot;
        if $gzerrno != Z_STREAM_END ;

    $gz-&gt;gzclose() ;
}</code></pre>

<p>Below is a script which makes use of <code>gzreadline</code>. It implements a very simple <i>grep</i> like script.</p>

<pre><code>use strict ;
use warnings ;

use Compress::Zlib ;

die &quot;Usage: gzgrep pattern [file...]\n&quot;
    unless @ARGV &gt;= 1;

my $pattern = shift ;

# use stdin if no files supplied
@ARGV = &#39;-&#39; unless @ARGV ;

foreach my $file (@ARGV) {
    my $gz = gzopen($file, &quot;rb&quot;)
         or die &quot;Cannot open $file: $gzerrno\n&quot; ;

    while ($gz-&gt;gzreadline($_) &gt; 0) {
        print if /$pattern/ ;
    }

    die &quot;Error reading from $file: $gzerrno\n&quot;
        if $gzerrno != Z_STREAM_END ;

    $gz-&gt;gzclose() ;
}</code></pre>

<p>This script, <i>gzstream</i>, does the opposite of the <i>gzcat</i> script above. It reads from standard input and writes a gzip data stream to standard output.</p>

<pre><code>use strict ;
use warnings ;

use Compress::Zlib ;

binmode STDOUT;  # gzopen only sets it on the fd

my $gz = gzopen(\*STDOUT, &quot;wb&quot;)
      or die &quot;Cannot open stdout: $gzerrno\n&quot; ;

while (&lt;&gt;) {
    $gz-&gt;gzwrite($_)
      or die &quot;error writing: $gzerrno\n&quot; ;
}

$gz-&gt;gzclose ;</code></pre>

<h2 id="Compress::Zlib::memGzip"><a class="permalink" href="./Compress::Zlib.html#Compress::Zlib::memGzip">#</a><a id="Compress"></a>Compress::Zlib::memGzip</h2>

<p>This function is used to create an in-memory gzip file with the minimum possible gzip header (exactly 10 bytes).</p>

<pre><code>$dest = Compress::Zlib::memGzip($buffer)
    or die &quot;Cannot compress: $gzerrno\n&quot;;</code></pre>

<p>If successful, it returns the in-memory gzip file. Otherwise it returns <code>undef</code> and the <code>$gzerrno</code> variable will store the zlib error code.</p>

<p>The <code>$buffer</code> parameter can either be a scalar or a scalar reference.</p>

<p>See <a href="./IO::Compress::Gzip.html">IO::Compress::Gzip</a> for an alternative way to carry out in-memory gzip compression.</p>

<h2 id="Compress::Zlib::memGunzip"><a class="permalink" href="./Compress::Zlib.html#Compress::Zlib::memGunzip">#</a><a id="Compress1"></a>Compress::Zlib::memGunzip</h2>

<p>This function is used to uncompress an in-memory gzip file.</p>

<pre><code>$dest = Compress::Zlib::memGunzip($buffer)
    or die &quot;Cannot uncompress: $gzerrno\n&quot;;</code></pre>

<p>If successful, it returns the uncompressed gzip file. Otherwise it returns <code>undef</code> and the <code>$gzerrno</code> variable will store the zlib error code.</p>

<p>The <code>$buffer</code> parameter can either be a scalar or a scalar reference. The contents of the <code>$buffer</code> parameter are destroyed after calling this function.</p>

<p>If <code>$buffer</code> consists of multiple concatenated gzip data streams only the first will be uncompressed. Use <code>gunzip</code> with the <code>MultiStream</code> option in the <code>IO::Uncompress::Gunzip</code> module if you need to deal with concatenated data streams.</p>

<p>See <a href="./IO::Uncompress::Gunzip.html">IO::Uncompress::Gunzip</a> for an alternative way to carry out in-memory gzip uncompression.</p>

<h1 id="COMPRESS/UNCOMPRESS"><a class="permalink" href="./Compress::Zlib.html#COMPRESS/UNCOMPRESS">#</a><a id="COMPRESS"></a><a id="COMPRESS-UNCOMPRESS"></a>COMPRESS/UNCOMPRESS</h1>

<p>Two functions are provided to perform in-memory compression/uncompression of RFC 1950 data streams. They are called <code>compress</code> and <code>uncompress</code>.</p>

<dl>

<dt id="$dest-=-compress($source-[,-$level]-)-;"><a class="permalink" href="./Compress::Zlib.html#$dest-=-compress($source-%5B,-$level%5D-)-;">#</a><a id="dest-compress-source-level"></a><b>$dest = compress($source [, $level] ) ;</b></dt>
<dd>

<p>Compresses <code>$source</code>. If successful it returns the compressed data. Otherwise it returns <i>undef</i>.</p>

<p>The source buffer, <code>$source</code>, can either be a scalar or a scalar reference.</p>

<p>The <code>$level</code> parameter defines the compression level. Valid values are 0 through 9, <code>Z_NO_COMPRESSION</code>, <code>Z_BEST_SPEED</code>, <code>Z_BEST_COMPRESSION</code>, and <code>Z_DEFAULT_COMPRESSION</code>. If <code>$level</code> is not specified <code>Z_DEFAULT_COMPRESSION</code> will be used.</p>

</dd>
<dt id="$dest-=-uncompress($source)-;"><a class="permalink" href="./Compress::Zlib.html#$dest-=-uncompress($source)-;">#</a><a id="dest-uncompress-source"></a><b>$dest = uncompress($source) ;</b></dt>
<dd>

<p>Uncompresses <code>$source</code>. If successful it returns the uncompressed data. Otherwise it returns <i>undef</i>.</p>

<p>The source buffer can either be a scalar or a scalar reference.</p>

</dd>
</dl>

<p>Please note: the two functions defined above are <i>not</i> compatible with the Unix commands of the same name.</p>

<p>See <a href="https://perldoc.perl.org/5.35.0/IO::Deflate">IO::Deflate</a> and <a href="https://perldoc.perl.org/5.35.0/IO::Inflate">IO::Inflate</a> included with this distribution for an alternative interface for reading/writing RFC 1950 files/buffers.</p>

<h1 id="Deflate-Interface"><a class="permalink" href="./Compress::Zlib.html#Deflate-Interface">#</a><a id="Deflate"></a>Deflate Interface</h1>

<p>This section defines an interface that allows in-memory compression using the <i>deflate</i> interface provided by zlib.</p>

<p>Here is a definition of the interface available:</p>

<h2 id="($d,-$status)-=-deflateInit(-[OPT]-)"><a class="permalink" href="./Compress::Zlib.html#($d,-$status)-=-deflateInit(-%5BOPT%5D-)">#</a><a id="d-status-deflateInit-OPT"></a><b>($d, $status) = deflateInit( [OPT] )</b></h2>

<p>Initialises a deflation stream.</p>

<p>It combines the features of the <i>zlib</i> functions <code>deflateInit</code>, <code>deflateInit2</code> and <code>deflateSetDictionary</code>.</p>

<p>If successful, it will return the initialised deflation stream, <code>$d</code> and <code>$status</code> of <code>Z_OK</code> in a list context. In scalar context it returns the deflation stream, <code>$d</code>, only.</p>

<p>If not successful, the returned deflation stream (<code>$d</code>) will be <i>undef</i> and <code>$status</code> will hold the exact <i>zlib</i> error code.</p>

<p>The function optionally takes a number of named options specified as <code>-Name=&gt;value</code> pairs. This allows individual options to be tailored without having to specify them all in the parameter list.</p>

<p>For backward compatibility, it is also possible to pass the parameters as a reference to a hash containing the name=&gt;value pairs.</p>

<p>The function takes one optional parameter, a reference to a hash. The contents of the hash allow the deflation interface to be tailored.</p>

<p>Here is a list of the valid options:</p>

<dl>

<dt id="-Level"><a class="permalink" href="./Compress::Zlib.html#-Level">#</a><a id="Level"></a><b>-Level</b></dt>
<dd>

<p>Defines the compression level. Valid values are 0 through 9, <code>Z_NO_COMPRESSION</code>, <code>Z_BEST_SPEED</code>, <code>Z_BEST_COMPRESSION</code>, and <code>Z_DEFAULT_COMPRESSION</code>.</p>

<p>The default is Z_DEFAULT_COMPRESSION.</p>

</dd>
<dt id="-Method"><a class="permalink" href="./Compress::Zlib.html#-Method">#</a><a id="Method"></a><b>-Method</b></dt>
<dd>

<p>Defines the compression method. The only valid value at present (and the default) is Z_DEFLATED.</p>

</dd>
<dt id="-WindowBits"><a class="permalink" href="./Compress::Zlib.html#-WindowBits">#</a><a id="WindowBits"></a><b>-WindowBits</b></dt>
<dd>

<p>To create an RFC 1950 data stream, set <code>WindowBits</code> to a positive number.</p>

<p>To create an RFC 1951 data stream, set <code>WindowBits</code> to <code>-MAX_WBITS</code>.</p>

<p>For a full definition of the meaning and valid values for <code>WindowBits</code> refer to the <i>zlib</i> documentation for <i>deflateInit2</i>.</p>

<p>Defaults to MAX_WBITS.</p>

</dd>
<dt id="-MemLevel"><a class="permalink" href="./Compress::Zlib.html#-MemLevel">#</a><a id="MemLevel"></a><b>-MemLevel</b></dt>
<dd>

<p>For a definition of the meaning and valid values for <code>MemLevel</code> refer to the <i>zlib</i> documentation for <i>deflateInit2</i>.</p>

<p>Defaults to MAX_MEM_LEVEL.</p>

</dd>
<dt id="-Strategy"><a class="permalink" href="./Compress::Zlib.html#-Strategy">#</a><a id="Strategy"></a><b>-Strategy</b></dt>
<dd>

<p>Defines the strategy used to tune the compression. The valid values are <code>Z_DEFAULT_STRATEGY</code>, <code>Z_FILTERED</code> and <code>Z_HUFFMAN_ONLY</code>.</p>

<p>The default is Z_DEFAULT_STRATEGY.</p>

</dd>
<dt id="-Dictionary"><a class="permalink" href="./Compress::Zlib.html#-Dictionary">#</a><a id="Dictionary"></a><b>-Dictionary</b></dt>
<dd>

<p>When a dictionary is specified <i>Compress::Zlib</i> will automatically call <code>deflateSetDictionary</code> directly after calling <code>deflateInit</code>. The Adler32 value for the dictionary can be obtained by calling the method <code>$d-&gt;dict_adler()</code>.</p>

<p>The default is no dictionary.</p>

</dd>
<dt id="-Bufsize"><a class="permalink" href="./Compress::Zlib.html#-Bufsize">#</a><a id="Bufsize"></a><b>-Bufsize</b></dt>
<dd>

<p>Sets the initial size for the deflation buffer. If the buffer has to be reallocated to increase the size, it will grow in increments of <code>Bufsize</code>.</p>

<p>The default is 4096.</p>

</dd>
</dl>

<p>Here is an example of using the <code>deflateInit</code> optional parameter list to override the default buffer size and compression level. All other options will take their default values.</p>

<pre><code>deflateInit( -Bufsize =&gt; 300,
             -Level =&gt; Z_BEST_SPEED  ) ;</code></pre>

<h2 id="($out,-$status)-=-$d-&gt;deflate($buffer)"><a class="permalink" href="./Compress::Zlib.html#($out,-$status)-=-$d-%3Edeflate($buffer)">#</a><a id="out-status-d-deflate-buffer"></a><b>($out, $status) = $d-&gt;deflate($buffer)</b></h2>

<p>Deflates the contents of <code>$buffer</code>. The buffer can either be a scalar or a scalar reference. When finished, <code>$buffer</code> will be completely processed (assuming there were no errors). If the deflation was successful it returns the deflated output, <code>$out</code>, and a status value, <code>$status</code>, of <code>Z_OK</code>.</p>

<p>On error, <code>$out</code> will be <i>undef</i> and <code>$status</code> will contain the <i>zlib</i> error code.</p>

<p>In a scalar context <code>deflate</code> will return <code>$out</code> only.</p>

<p>As with the <i>deflate</i> function in <i>zlib</i>, it is not necessarily the case that any output will be produced by this method. So don&#39;t rely on the fact that <code>$out</code> is empty for an error test.</p>

<h2 id="($out,-$status)-=-$d-&gt;flush()-=head2-($out,-$status)-=-$d-&gt;flush($flush_type)"><a class="permalink" href="./Compress::Zlib.html#($out,-$status)-=-$d-%3Eflush()-=head2-($out,-$status)-=-$d-%3Eflush($flush_type)">#</a><a id="out-status-d-flush-head2-out-status-d-flush-flush_type"></a><b>($out, $status) = $d-&gt;flush()</b> =head2 <b>($out, $status) = $d-&gt;flush($flush_type)</b></h2>

<p>Typically used to finish the deflation. Any pending output will be returned via <code>$out</code>. <code>$status</code> will have a value <code>Z_OK</code> if successful.</p>

<p>In a scalar context <code>flush</code> will return <code>$out</code> only.</p>

<p>Note that flushing can seriously degrade the compression ratio, so it should only be used to terminate a decompression (using <code>Z_FINISH</code>) or when you want to create a <i>full flush point</i> (using <code>Z_FULL_FLUSH</code>).</p>

<p>By default the <code>flush_type</code> used is <code>Z_FINISH</code>. Other valid values for <code>flush_type</code> are <code>Z_NO_FLUSH</code>, <code>Z_PARTIAL_FLUSH</code>, <code>Z_SYNC_FLUSH</code> and <code>Z_FULL_FLUSH</code>. It is strongly recommended that you only set the <code>flush_type</code> parameter if you fully understand the implications of what it does. See the <code>zlib</code> documentation for details.</p>

<h2 id="$status-=-$d-&gt;deflateParams([OPT])"><a class="permalink" href="./Compress::Zlib.html#$status-=-$d-%3EdeflateParams(%5BOPT%5D)">#</a><a id="status-d-deflateParams-OPT"></a><b>$status = $d-&gt;deflateParams([OPT])</b></h2>

<p>Change settings for the deflate stream <code>$d</code>.</p>

<p>The list of the valid options is shown below. Options not specified will remain unchanged.</p>

<dl>

<dt id="-Level1"><a class="permalink" href="./Compress::Zlib.html#-Level1">#</a><a id="Level1"></a><b>-Level</b></dt>
<dd>

<p>Defines the compression level. Valid values are 0 through 9, <code>Z_NO_COMPRESSION</code>, <code>Z_BEST_SPEED</code>, <code>Z_BEST_COMPRESSION</code>, and <code>Z_DEFAULT_COMPRESSION</code>.</p>

</dd>
<dt id="-Strategy1"><a class="permalink" href="./Compress::Zlib.html#-Strategy1">#</a><a id="Strategy1"></a><b>-Strategy</b></dt>
<dd>

<p>Defines the strategy used to tune the compression. The valid values are <code>Z_DEFAULT_STRATEGY</code>, <code>Z_FILTERED</code> and <code>Z_HUFFMAN_ONLY</code>.</p>

</dd>
</dl>

<h2 id="$d-&gt;dict_adler()"><a class="permalink" href="./Compress::Zlib.html#$d-%3Edict_adler()">#</a><a id="dict_adler"></a><a id="d-dict_adler"></a><b>$d-&gt;dict_adler()</b></h2>

<p>Returns the adler32 value for the dictionary.</p>

<h2 id="$d-&gt;msg()"><a class="permalink" href="./Compress::Zlib.html#$d-%3Emsg()">#</a><a id="msg"></a><a id="d-msg"></a><b>$d-&gt;msg()</b></h2>

<p>Returns the last error message generated by zlib.</p>

<h2 id="$d-&gt;total_in()"><a class="permalink" href="./Compress::Zlib.html#$d-%3Etotal_in()">#</a><a id="total_in"></a><a id="d-total_in"></a><b>$d-&gt;total_in()</b></h2>

<p>Returns the total number of bytes uncompressed bytes input to deflate.</p>

<h2 id="$d-&gt;total_out()"><a class="permalink" href="./Compress::Zlib.html#$d-%3Etotal_out()">#</a><a id="total_out"></a><a id="d-total_out"></a><b>$d-&gt;total_out()</b></h2>

<p>Returns the total number of compressed bytes output from deflate.</p>

<h2 id="Example"><a class="permalink" href="./Compress::Zlib.html#Example">#</a>Example</h2>

<p>Here is a trivial example of using <code>deflate</code>. It simply reads standard input, deflates it and writes it to standard output.</p>

<pre><code>use strict ;
use warnings ;

use Compress::Zlib ;

binmode STDIN;
binmode STDOUT;
my $x = deflateInit()
   or die &quot;Cannot create a deflation stream\n&quot; ;

my ($output, $status) ;
while (&lt;&gt;)
{
    ($output, $status) = $x-&gt;deflate($_) ;

    $status == Z_OK
        or die &quot;deflation failed\n&quot; ;

    print $output ;
}

($output, $status) = $x-&gt;flush() ;

$status == Z_OK
    or die &quot;deflation failed\n&quot; ;

print $output ;</code></pre>

<h1 id="Inflate-Interface"><a class="permalink" href="./Compress::Zlib.html#Inflate-Interface">#</a><a id="Inflate"></a>Inflate Interface</h1>

<p>This section defines the interface available that allows in-memory uncompression using the <i>deflate</i> interface provided by zlib.</p>

<p>Here is a definition of the interface:</p>

<h2 id="($i,-$status)-=-inflateInit()"><a class="permalink" href="./Compress::Zlib.html#($i,-$status)-=-inflateInit()">#</a><a id="i-status-inflateInit"></a><b>($i, $status) = inflateInit()</b></h2>

<p>Initialises an inflation stream.</p>

<p>In a list context it returns the inflation stream, <code>$i</code>, and the <i>zlib</i> status code in <code>$status</code>. In a scalar context it returns the inflation stream only.</p>

<p>If successful, <code>$i</code> will hold the inflation stream and <code>$status</code> will be <code>Z_OK</code>.</p>

<p>If not successful, <code>$i</code> will be <i>undef</i> and <code>$status</code> will hold the <i>zlib</i> error code.</p>

<p>The function optionally takes a number of named options specified as <code>-Name=&gt;value</code> pairs. This allows individual options to be tailored without having to specify them all in the parameter list.</p>

<p>For backward compatibility, it is also possible to pass the parameters as a reference to a hash containing the name=&gt;value pairs.</p>

<p>The function takes one optional parameter, a reference to a hash. The contents of the hash allow the deflation interface to be tailored.</p>

<p>Here is a list of the valid options:</p>

<dl>

<dt id="-WindowBits1"><a class="permalink" href="./Compress::Zlib.html#-WindowBits1">#</a><a id="WindowBits1"></a><b>-WindowBits</b></dt>
<dd>

<p>To uncompress an RFC 1950 data stream, set <code>WindowBits</code> to a positive number.</p>

<p>To uncompress an RFC 1951 data stream, set <code>WindowBits</code> to <code>-MAX_WBITS</code>.</p>

<p>For a full definition of the meaning and valid values for <code>WindowBits</code> refer to the <i>zlib</i> documentation for <i>inflateInit2</i>.</p>

<p>Defaults to MAX_WBITS.</p>

</dd>
<dt id="-Bufsize1"><a class="permalink" href="./Compress::Zlib.html#-Bufsize1">#</a><a id="Bufsize1"></a><b>-Bufsize</b></dt>
<dd>

<p>Sets the initial size for the inflation buffer. If the buffer has to be reallocated to increase the size, it will grow in increments of <code>Bufsize</code>.</p>

<p>Default is 4096.</p>

</dd>
<dt id="-Dictionary1"><a class="permalink" href="./Compress::Zlib.html#-Dictionary1">#</a><a id="Dictionary1"></a><b>-Dictionary</b></dt>
<dd>

<p>The default is no dictionary.</p>

</dd>
</dl>

<p>Here is an example of using the <code>inflateInit</code> optional parameter to override the default buffer size.</p>

<pre><code>inflateInit( -Bufsize =&gt; 300 ) ;</code></pre>

<h2 id="($out,-$status)-=-$i-&gt;inflate($buffer)"><a class="permalink" href="./Compress::Zlib.html#($out,-$status)-=-$i-%3Einflate($buffer)">#</a><a id="out-status-i-inflate-buffer"></a><b>($out, $status) = $i-&gt;inflate($buffer)</b></h2>

<p>Inflates the complete contents of <code>$buffer</code>. The buffer can either be a scalar or a scalar reference.</p>

<p>Returns <code>Z_OK</code> if successful and <code>Z_STREAM_END</code> if the end of the compressed data has been successfully reached. If not successful, <code>$out</code> will be <i>undef</i> and <code>$status</code> will hold the <i>zlib</i> error code.</p>

<p>The <code>$buffer</code> parameter is modified by <code>inflate</code>. On completion it will contain what remains of the input buffer after inflation. This means that <code>$buffer</code> will be an empty string when the return status is <code>Z_OK</code>. When the return status is <code>Z_STREAM_END</code> the <code>$buffer</code> parameter will contains what (if anything) was stored in the input buffer after the deflated data stream.</p>

<p>This feature is useful when processing a file format that encapsulates a compressed data stream (e.g. gzip, zip).</p>

<h2 id="$status-=-$i-&gt;inflateSync($buffer)"><a class="permalink" href="./Compress::Zlib.html#$status-=-$i-%3EinflateSync($buffer)">#</a><a id="status-i-inflateSync-buffer"></a><b>$status = $i-&gt;inflateSync($buffer)</b></h2>

<p>Scans <code>$buffer</code> until it reaches either a <i>full flush point</i> or the end of the buffer.</p>

<p>If a <i>full flush point</i> is found, <code>Z_OK</code> is returned and <code>$buffer</code> will be have all data up to the flush point removed. This can then be passed to the <code>deflate</code> method.</p>

<p>Any other return code means that a flush point was not found. If more data is available, <code>inflateSync</code> can be called repeatedly with more compressed data until the flush point is found.</p>

<h2 id="$i-&gt;dict_adler()"><a class="permalink" href="./Compress::Zlib.html#$i-%3Edict_adler()">#</a><a id="dict_adler1"></a><a id="i-dict_adler"></a><b>$i-&gt;dict_adler()</b></h2>

<p>Returns the adler32 value for the dictionary.</p>

<h2 id="$i-&gt;msg()"><a class="permalink" href="./Compress::Zlib.html#$i-%3Emsg()">#</a><a id="msg1"></a><a id="i-msg"></a><b>$i-&gt;msg()</b></h2>

<p>Returns the last error message generated by zlib.</p>

<h2 id="$i-&gt;total_in()"><a class="permalink" href="./Compress::Zlib.html#$i-%3Etotal_in()">#</a><a id="total_in1"></a><a id="i-total_in"></a><b>$i-&gt;total_in()</b></h2>

<p>Returns the total number of bytes compressed bytes input to inflate.</p>

<h2 id="$i-&gt;total_out()"><a class="permalink" href="./Compress::Zlib.html#$i-%3Etotal_out()">#</a><a id="total_out1"></a><a id="i-total_out"></a><b>$i-&gt;total_out()</b></h2>

<p>Returns the total number of uncompressed bytes output from inflate.</p>

<h2 id="Example1"><a class="permalink" href="./Compress::Zlib.html#Example1">#</a>Example</h2>

<p>Here is an example of using <code>inflate</code>.</p>

<pre><code>use strict ;
use warnings ;

use Compress::Zlib ;

my $x = inflateInit()
   or die &quot;Cannot create a inflation stream\n&quot; ;

my $input = &#39;&#39; ;
binmode STDIN;
binmode STDOUT;

my ($output, $status) ;
while (read(STDIN, $input, 4096))
{
    ($output, $status) = $x-&gt;inflate(\$input) ;

    print $output
        if $status == Z_OK or $status == Z_STREAM_END ;

    last if $status != Z_OK ;
}

die &quot;inflation failed\n&quot;
    unless $status == Z_STREAM_END ;</code></pre>

<h1 id="CHECKSUM-FUNCTIONS"><a class="permalink" href="./Compress::Zlib.html#CHECKSUM-FUNCTIONS">#</a><a id="CHECKSUM"></a>CHECKSUM FUNCTIONS</h1>

<p>Two functions are provided by <i>zlib</i> to calculate checksums. For the Perl interface, the order of the two parameters in both functions has been reversed. This allows both running checksums and one off calculations to be done.</p>

<pre><code>$crc = adler32($buffer [,$crc]) ;
$crc = crc32($buffer [,$crc]) ;</code></pre>

<p>The buffer parameters can either be a scalar or a scalar reference.</p>

<p>If the $crc parameters is <code>undef</code>, the crc value will be reset.</p>

<p>If you have built this module with zlib 1.2.3 or better, two more CRC-related functions are available.</p>

<pre><code>$crc = crc32_combine($crc1, $crc2, $len2);
$adler = adler32_combine($adler1, $adler2, $len2);</code></pre>

<p>These functions allow checksums to be merged. Refer to the <i>zlib</i> documentation for more details.</p>

<h1 id="Misc"><a class="permalink" href="./Compress::Zlib.html#Misc">#</a>Misc</h1>

<h2 id="my-$version-=-Compress::Zlib::zlib_version();"><a class="permalink" href="./Compress::Zlib.html#my-$version-=-Compress::Zlib::zlib_version();">#</a><a id="my"></a><a id="my-version-Compress::Zlib::zlib_version"></a>my $version = Compress::Zlib::zlib_version();</h2>

<p>Returns the version of the zlib library.</p>

<h1 id="CONSTANTS"><a class="permalink" href="./Compress::Zlib.html#CONSTANTS">#</a>CONSTANTS</h1>

<p>All the <i>zlib</i> constants are automatically imported when you make use of <i>Compress::Zlib</i>.</p>

<h1 id="SUPPORT"><a class="permalink" href="./Compress::Zlib.html#SUPPORT">#</a>SUPPORT</h1>

<p>General feedback/questions/bug reports should be sent to <a href="https://github.com/pmqs/IO-Compress/issues">https://github.com/pmqs/IO-Compress/issues</a> (preferred) or <a href="https://rt.cpan.org/Public/Dist/Display.html?Name=IO-Compress">https://rt.cpan.org/Public/Dist/Display.html?Name=IO-Compress</a>.</p>

<h1 id="SEE-ALSO"><a class="permalink" href="./Compress::Zlib.html#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1>

<p><a href="./IO::Compress::Gzip.html">IO::Compress::Gzip</a>, <a href="./IO::Uncompress::Gunzip.html">IO::Uncompress::Gunzip</a>, <a href="./IO::Compress::Deflate.html">IO::Compress::Deflate</a>, <a href="./IO::Uncompress::Inflate.html">IO::Uncompress::Inflate</a>, <a href="./IO::Compress::RawDeflate.html">IO::Compress::RawDeflate</a>, <a href="./IO::Uncompress::RawInflate.html">IO::Uncompress::RawInflate</a>, <a href="./IO::Compress::Bzip2.html">IO::Compress::Bzip2</a>, <a href="./IO::Uncompress::Bunzip2.html">IO::Uncompress::Bunzip2</a>, <a href="./IO::Compress::Lzma.html">IO::Compress::Lzma</a>, <a href="./IO::Uncompress::UnLzma.html">IO::Uncompress::UnLzma</a>, <a href="./IO::Compress::Xz.html">IO::Compress::Xz</a>, <a href="./IO::Uncompress::UnXz.html">IO::Uncompress::UnXz</a>, <a href="./IO::Compress::Lzip.html">IO::Compress::Lzip</a>, <a href="./IO::Uncompress::UnLzip.html">IO::Uncompress::UnLzip</a>, <a href="./IO::Compress::Lzop.html">IO::Compress::Lzop</a>, <a href="./IO::Uncompress::UnLzop.html">IO::Uncompress::UnLzop</a>, <a href="./IO::Compress::Lzf.html">IO::Compress::Lzf</a>, <a href="./IO::Uncompress::UnLzf.html">IO::Uncompress::UnLzf</a>, <a href="./IO::Compress::Zstd.html">IO::Compress::Zstd</a>, <a href="./IO::Uncompress::UnZstd.html">IO::Uncompress::UnZstd</a>, <a href="./IO::Uncompress::AnyInflate.html">IO::Uncompress::AnyInflate</a>, <a href="./IO::Uncompress::AnyUncompress.html">IO::Uncompress::AnyUncompress</a></p>

<p><a href="./IO::Compress::FAQ.html">IO::Compress::FAQ</a></p>

<p><a href="./File::GlobMapper.html">File::GlobMapper</a>, <a href="./Archive::Zip.html">Archive::Zip</a>, <a href="./Archive::Tar.html">Archive::Tar</a>, <a href="./IO::Zlib.html">IO::Zlib</a></p>

<p>For RFC 1950, 1951 and 1952 see <a href="http://www.faqs.org/rfcs/rfc1950.html">http://www.faqs.org/rfcs/rfc1950.html</a>, <a href="http://www.faqs.org/rfcs/rfc1951.html">http://www.faqs.org/rfcs/rfc1951.html</a> and <a href="http://www.faqs.org/rfcs/rfc1952.html">http://www.faqs.org/rfcs/rfc1952.html</a></p>

<p>The <i>zlib</i> compression library was written by Jean-loup Gailly <code>gzip@prep.ai.mit.edu</code> and Mark Adler <code>madler@alumni.caltech.edu</code>.</p>

<p>The primary site for the <i>zlib</i> compression library is <a href="http://www.zlib.org">http://www.zlib.org</a>.</p>

<p>The primary site for gzip is <a href="http://www.gzip.org">http://www.gzip.org</a>.</p>

<h1 id="AUTHOR"><a class="permalink" href="./Compress::Zlib.html#AUTHOR">#</a>AUTHOR</h1>

<p>This module was written by Paul Marquess, <code>pmqs@cpan.org</code>.</p>

<h1 id="MODIFICATION-HISTORY"><a class="permalink" href="./Compress::Zlib.html#MODIFICATION-HISTORY">#</a><a id="MODIFICATION"></a>MODIFICATION HISTORY</h1>

<p>See the Changes file.</p>

<h1 id="COPYRIGHT-AND-LICENSE"><a class="permalink" href="./Compress::Zlib.html#COPYRIGHT-AND-LICENSE">#</a><a id="COPYRIGHT"></a>COPYRIGHT AND LICENSE</h1>

<p>Copyright (c) 1995-2021 Paul Marquess. All rights reserved.</p>

<p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
